// pages/chexian/lx/lx.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		sta: false,
		addTime:'',
		list:[]
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onShow: function(options) {
		wx.getStorage({
			key:'peijian',
			success:(e)=>{
				console.log(e)
				this.setData({
					list:e.data
				})
			}
		})
	},
	gemg(){
		this.setData({
			sta:false
		})
	},
	gaib(){
		this.setData({
			sta:true
		})
	},
	name(e){
		console.log(e)
		this.setData({
			name:e.detail.value
		})
	},
	price(e){
		this.setData({
			price:e.detail.value
		})
	},
	bindTimeChange: function(e) {
		this.setData({
			addTime:e.detail.value
		})
	},
	sure(){
		let a={'sbname':this.data.name,'price':this.data.price,'addTime':this.data.addTime}
		let b=this.data.list
		b.push(a)
		this.setData({
			sta:false,
			list:b,
			addTime:'',
			name:'',
			price:''
		})
		wx.setStorage({
			key:'peijian',
			data:this.data.list
		})
	},
	dele(e){
		let a=this.data.list
		a.splice(e.currentTarget.dataset.id,1)
		this.setData({
			list:a
		})
		wx.setStorage({
			key:'peijian',
			data:a
		})
	}
})
